package com.homework.dto;

import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

@Data
public class RegisterDto {
    @NotNull(message = "用户ID不能为空")
    @Min(value = 100000, message = "用户ID不能小于6位")
    @Max(value = 999999999, message = "用户ID不能大于9位")
    private Integer userId;

    @NotBlank(message = "密码不能为空")
    @Length(min = 6, max = 10, message = "密码长度必须在6-10之间")
    private String password;

    @NotBlank(message = "密码不能为空")
    @Length(min = 6, max = 10, message = "密码长度必须在6-10之间")
    private String confirmPassword;

    @NotBlank(message = "角色不能为空")
    @Pattern(regexp = "^[0-1]$", message = "角色只能是学生、老师")
    private String role;
    @NotBlank(message = "用户名不能为空")
    @Length(min = 2, max = 10, message = "姓名长度必须在2-10之间")
    private String name;

    @NotBlank(message = "性别不能为空")
    @Pattern(regexp = "^男|女$", message = "性别只能是男、女、未知")
    private String gender;

    private String classInfo;
    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;
    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;

    private String department;
}
